﻿using WMLogistics.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dapper;
using DapperExtensions;

namespace WMLogistics_Dao
{
   public  class SysMenuDao
    {
       /// <summary>
       /// 获取菜单数据
       /// </summary>
       /// <param name="company_id"></param>
       /// <returns></returns>
       public List<sys_menu> GetMeunList(int company_id)
       {
           string sql = @"SELECT d.* from wuliu_account_company as a 
                        LEFT JOIN wuliu_account_role as b on a.account_id=b.account_id
                        LEFT JOIN sys_role_menu as c on b.role_id=c.role_id
                        LEFT JOIN sys_menu as d on c.menu_id=d.id where a.company_id=@company_id";

           using (var conn = ConnectionHelper.OpenConnection())
           {
               return conn.Query<sys_menu>(sql, new { company_id = company_id }).ToList();
           }

       }
       

    }
}
